macro(ADD_DEMO APP)
    add_executable(${APP} ${ARGN})
    target_link_libraries(${APP} PRIVATE InventorXt Inventor)
    if (INVENTOR_DEMOS)
        install(TARGETS ${APP} DESTINATION ${IVDEMOBINDIR})
        if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${APP}.RUNME.in")
            configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${APP}.RUNME.in" "${CMAKE_CURRENT_BINARY_DIR}/${APP}.RUNME" @ONLY)
            install(PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/${APP}.RUNME" DESTINATION ${IVDEMOBINDIR})
        elseif (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${APP}.RUNME")
            install(PROGRAMS "${APP}.RUNME" DESTINATION ${IVDEMOBINDIR})
        endif()
        if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${APP}.about.pdf")
            install(FILES "${APP}.about.pdf" DESTINATION ${IVDEMOBINDIR})
        endif()
    endif()
endmacro()

add_subdirectory(SceneViewer)
if (INVENTOR_DEMOS)
    add_subdirectory(drop)
    add_subdirectory(gview)
    add_subdirectory(maze)
    add_subdirectory(noodle)
    add_subdirectory(qmorf)
    add_subdirectory(revo)
    add_subdirectory(textomatic)
endif()
